'''
Author: Luciano Hoult
Contact: lucianolee@zju.edu.cn
Company: Zhejiang University
Created Date: Tuesday December 10th 2019 2:02:58 pm
Last Modified: Wednesday May 13th 2020 12:33:36 am
'''


from functools import wraps
from flask import Flask
from flask import request, jsonify, make_response
from flask_cors import CORS

app = Flask(__name__)

# Suppress CORB(Cross-Origin Read Blocking) error
def allowCORB(func):
     def wrapper(*arg, **kwargs):
         resp = make_response(func(*arg, **kwargs))
         resp.headers['Access-Control-Allow-Origin'] = '*'
         resp.headers['Access-Control-Allow-Methods'] = 'PUT,GET,POST,DELETE'
         resp.headers['Access-Control-Allow-Headers'] = '*'
         return resp
     return wrapper

# @allowCORB

# Add a fingerprint
@app.route('/fp_add')

def fp_add():
    name_add = request.args.get('name')
    
    return jsonify({'result': 1})

# Delete a fingerprint
@app.route('/fp_del')

def fp_del():
    name_del = request.args.get('name')
    return jsonify({'result': 1})

# Check a fingerprint
@app.route('/fp_chk')

def fp_chk():
    return jsonify({'result': 2})

CORS(app)

if __name__ == '__main__':
    app.run(host='0.0.0.0', port=8000, debug=True)